﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using DotNETX.Web.Authority;

namespace DotNETX.Authentication.Web.Demo.Validater
{
    public class PassStaticFileAuthorityValidater : IAuthorityValidater
    {
        public AuthorityValidateResult Validate(HttpContext context)
        {
            if (context.Session == null && 
                (context.Request.Path.StartsWith("/Scripts") || context.Request.Path.StartsWith("/Images")))
            {
                return new AuthorityValidateResult() { Level = int.MaxValue, Passable = true };
            }
            else
            {
                return new AuthorityValidateResult() { Level = 0, Passable = false };
            }
        }
    }
}